<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h1>{{web.show}}</h1>
    <h1 v-show="web.show">文字显示出来了</h1>
    <button @click='toggle'>显示切换</button>
    <hr>


  </div>
  <script type="module">
    import { createApp, reactive } from './vue.esm-browser.js'

    createApp({
      setup() {
        const web = reactive({
          show: true
        })
        // 切换状态函数
        const toggle = () => {
          // 三元表达式
          // web.show == true ? web.show = false : web.show = true
          // 取反方法
          web.show = !web.show
        }
        return {
          web,
          toggle
        }
      }
    }).mount("#app")

  </script>
</body>

</html>